package top.kaoshanji.p1ch04a;

/**
 * 代码清单-p1ch04a-052页a：使用对象赋值还是有点棘手的
 * author kaoshanji
 * ^_^
 * create time 2025/3/6 16:07
 */
public class Assignment {

    public static void main(String[] args) {
        Tank t1 = new Tank();
        Tank t2 = new Tank();

        t1.level = 9;
        t2.level = 47;

        System.out.println("1: t1.level: " + t1.level + ", t2.level: " + t2.level);

        t1 = t2; // 此时，t1、t2 指向的都是 t1 这个对象的内存空间
        System.out.println("2: t1.level: " + t1.level + ", t2.level: " + t2.level);

        t1.level = 27;
        System.out.println("3: t1.level: " + t1.level + ", t2.level: " + t2.level);

    }

}

class Tank {
    int level;
}
